const bcrypt = require("bcryptjs");
const randomstring = require("randomstring");
exports.hash = (myPlaintextPassword) => {
  return new Promise((resolve, reject) => {
    bcrypt.hash(myPlaintextPassword, 10, (err, hash) => {
      if (err) {
        reject(err);
      }
      resolve(hash);
    });
  });
};
exports.compare = (myPlaintextPassword, hash) => {
  return bcrypt.compare(myPlaintextPassword, hash)
}
exports.generateStr = () => {
  return randomstring.generate();
}